package HomeWOrk2;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class test2 {
    public static void main(String[] args) {
        HashSet<String> treeSet = new HashSet<>();
        treeSet.add("刘备");
        treeSet.add("关羽");
        treeSet.add("张飞");
        treeSet.add("刘备");
        treeSet.add("张飞");
        System.out.println(treeSet.size());
        for (String s : treeSet) {
            System.out.println(s);
        }
        Iterator<String> iterator = treeSet.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            System.out.println(next);
        }
    }
}
